package com.huashizhaoxi.lionapp.service.Impl;

import com.huashizhaoxi.lionapp.dao.UserMapper;
import com.huashizhaoxi.lionapp.entity.Address;
import com.huashizhaoxi.lionapp.entity.User;
import com.huashizhaoxi.lionapp.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    UserMapper userMapper;

    @Override
    public List<User> getAllUser() {
        return userMapper.getAllUser() ;
    }

    @Override
    public User getUserByOpenId(String open_id) {
        return userMapper.getUserByOpenId(open_id);
    }

    @Override
    public User getUserById(int id) {
        return userMapper.getUserById(id);
    }

    @Override
    public int addUser(User user) {
        return userMapper.addUser(user);
    }

    @Override
    public int modifyUser(User user) {
        return userMapper.modifyUser(user);
    }

    @Override
    public List<Address> getAllAddress(int id) {
        return userMapper.getAllAddress(id);
    }

    @Override
    public int addAddress(Address address) {
        return userMapper.addAddress(address);
    }

    @Override
    public int modifyAddress(Address address) {
        return userMapper.modifyAddress(address);
    }

    @Override
    public List<User> searchUser(String text) {
        return userMapper.searchUser(text);
    }

    @Override
    public int changeRole(User user) {
        return userMapper.changeRole(user);
    }
}
